from rest_framework import serializers

from address.models import Address


class AddressListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Address
        fields = (
            "id", "title", "receiver", "province", "city", "district", "place", "mobile", "tel", "email", "is_default")


class CreateAddressSerializer(serializers.ModelSerializer):
    user = serializers.HiddenField(default=serializers.CurrentUserDefault(), write_only=True)

    class Meta:
        model = Address
        fields = (
            "user", "title", "receiver", "province", "city", "district", "place", "mobile", "tel", "email")
